import type IForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';

import CopyWebpackPlugin from 'copy-webpack-plugin';
import path from 'path';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const ForkTsCheckerWebpackPlugin: typeof IForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

export const plugins = [
  new ForkTsCheckerWebpackPlugin({
    logger: 'webpack-infrastructure',
  }),
  new CopyWebpackPlugin({
    patterns: [
      {
        from: path.resolve(__dirname, 'public'), // 静态资源源文件夹
        to: path.resolve(__dirname, '.webpack/renderer/'), // 目标输出目录
      },
      {
        from: path.resolve(__dirname, 'public'), // 静态资源源文件夹
        to: path.resolve(__dirname, '.webpack/renderer/main_window/'), // 目标输出目录
      },
    ],
  }),
];
